/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package test1.problem2;

import java.util.Random;

/**
 *
 * @author hoang.pt
 */
public class Data {

    /**
     * @var String[]
     */
    String[] name = {
        "thang",
        "huyen",
        "bach",
        "nga",
        "mai"
    };

    /**
     * @var boolean, flag to specify
     */
    boolean flag = false;

    /**
     * @var int
     */
    int random;

    /**
     * constructor
     */
    public Data() {
        
    }

    /**
     * step 1
     * @author hoang.pt
     * @return
     */
    public void getRandom() {

        //init
        Random randomObj = new Random();
        int rn = randomObj.nextInt(5);
        System.out.println(rn);

        try {
            //sleep
            Thread.sleep(500);
            //this.random = rn;
        } catch (InterruptedException ex) {
        }

        this.random = rn;
    }

    /**
     * Step 2
     * @author hoang.pt
     */
    public void displayName() {

        System.out.println(this.name[this.random]);

        //sleep
        try {
            Thread.sleep(500);
        } catch (InterruptedException ex) {
        }
    }

}
